
export COMPATIBAL_CHIP
export chipname

chipname += $(strip $(CHIPNAME))

ifeq (goldengate, $(filter $(chipname), goldengate))
COMPATIBAL_CHIP += goldengate
endif

ifeq (greatbelt, $(filter $(chipname), greatbelt))
COMPATIBAL_CHIP += greatbelt
endif

ifeq ($(strip $(BOARD)),vxworks-board)
CPPFLAGS += -DSDK_IN_VXWORKS
CPPFLAGS += -DSDK_WORK_ENV=0
CPPFLAGS += -DSDK_WORK_PLATFORM=0
endif

ifeq ($(strip $(BOARD)),vxworks-sim)
CPPFLAGS += -DSDK_IN_VXWORKS
CPPFLAGS += -DUSE_SIM_MEM
CPPFLAGS += -DSDK_WORK_ENV=0
CPPFLAGS += -DSDK_WORK_PLATFORM=1
endif

ifneq ($(findstring HOST_IS_LE, $(CTC_CFLAGS)),HOST_IS_LE)
ifneq ($(strip $(ARCH)),powerpc)
CPPFLAGS += -DHOST_IS_LE=1
endif

ifeq ($(strip $(ARCH)),x86)
CPPFLAGS += -DHOST_IS_LE=1
CPPFLAGS += -DCTC_ARCH_X86
endif

ifeq ($(strip $(ARCH)),mips)
ifeq ($(strip $(CPU)),ls2f)
CPPFLAGS += -DHOST_IS_LE=1
else
CPPFLAGS += -DHOST_IS_LE=0
endif
CPPFLAGS += -DCTC_ARCH_MIPS
endif

ifeq ($(strip $(ARCH)),freescale)
CPPFLAGS += -DHOST_IS_LE=0
CPPFLAGS += -DCTC_ARCH_PPC
endif

ifeq ($(strip $(ARCH)),arm)
CPPFLAGS += -DHOST_IS_LE=1
endif

ifeq ($(strip $(ARCH)),arm64)
CPPFLAGS += -DHOST_IS_LE=1
CPPFLAGS += -DCTC_ARCH_ARM64
endif

ifeq ($(strip $(ARCH)),x86)
CPPFLAGS += -DHOST_IS_LE=1
endif
endif

ifneq ($(strip $(VER)),r)
CPPFLAGS += -DSDK_IN_DEBUG_VER
endif
ifeq (l2, $(filter $(strip $(featureMode)), l2))
    CPPFLAGS += -DFEATURE_MODE=1
else
	ifeq (l2l3, $(filter $(strip $(featureMode)), l2l3))
    CPPFLAGS += -DFEATURE_MODE=2
    else
    CPPFLAGS += -DFEATURE_MODE=0
    endif
endif

ifeq (duet2, $(filter $(chipname), duet2))
CPPFLAGS += -DDUET2
CPPFLAGS += -DTMX
endif

ifeq (arctic, $(filter $(chipname), arctic))
CPPFLAGS += -DARCTIC
CPPFLAGS += -DUSW
endif

ifeq (tsingma, $(filter $(chipname), tsingma))
CPPFLAGS += -DTSINGMA
CPPFLAGS += -DTMX
endif

ifeq (tsingma_mx, $(filter $(chipname), tsingma_mx))
CPPFLAGS += -DTSINGMA_MX
CPPFLAGS += -DTMX
endif

ifeq (tsingma_gx, $(filter $(chipname), tsingma_gx))
CPPFLAGS += -DTSINGMA_GX
CPPFLAGS += -DTMX
endif
ifeq (goldengate, $(filter $(chipname), goldengate))
CPPFLAGS += -DGOLDENGATE
endif

ifeq (greatbelt, $(filter $(chipname), greatbelt))
CPPFLAGS += -DGREATBELT
endif

ifeq ($(strip $(EUNIT)), yes)
CPPFLAGS += -DE_UNIT
endif

CPPFLAGS += -I$(VX_HEADER)/
CPPFLAGS += -I$(VX_HEADER)/wrn/coreip

ifeq ($(strip $(CPU)),SIMNT)
CFLAGS += -fno-strict-aliasing
else
CFLAGS += -fno-strict-aliasing -mlongcall
endif

ifneq ($(strip $(VER)),r)
CPPFLAGS += -DSDK_IN_DEBUG_VER
endif

CFLAGS += $(CTC_CFLAGS)
#add by zzhu for gcov
IS_GCOV = no

